<?php
namespace Library\Loader;
require_once(str_replace("Loader", "Traits/Patterns/Singleton.php", __DIR__));
class Autoloader
{
	use \Library\Traits\Patterns\Singleton;
	private static $basePath = NULL;
	
	public static function setBasePath($value)
	{
		self::$basePath = $value;
	}
	
	private function __construct()
	{
		spl_autoload_register(array(__CLASS__, "autoload"));
	}
	
	private static function autoload($class)
	{
		if (is_null(self::$basePath))
			throw new Exception("Autoloader::basePath is null");
		$filePath = self::$basePath.str_replace('\\', DIRECTORY_SEPARATOR, $class).".php";
		require_once($filePath);
	}
}
?>